//
// Fragment shader for procedural bricks
//
// Authors: Dave Baldwin, Steve Koren, Randi Rost
//          based on a shader by Darwyn Peachey
//
// Copyright (c) 2002-2006 3Dlabs Inc. Ltd. 
//
// See 3Dlabs-License.txt for license information
//

uniform vec3  TargetColor;
uniform vec3  BaseColor;

uniform vec3 Center;
uniform float Range;

varying vec3  Position;
varying float LightIntensity;

void main()
{
    float inTarget;

    if(distance(Position, Center) > Range)
        inTarget = 0.0;
    else
        inTarget = 1.0;    

    vec3  color;
    color  = mix(BaseColor, TargetColor, inTarget);
    color *= LightIntensity;
    gl_FragColor = vec4(color, 1.0);
}
